package chongxin;

public class test3 {
    public String print(String name,int be,int last){
        //创建数组
        String num[]={"小明","小红","张三"};
        //确定区间
        int qj=last-be;
        //接受输出语句
        String end1=" ";
        //区间不能超过数组的长度
        if(be>=0&&last< num.length){
            for(int i=be;i<=qj;i++){
                String zhi=num[i];
                if(zhi==name){
                    end1 ="查询成功,姓名为:]"+name;
                }else{
                    System.out.println("没有此人");
                }
            }

        }
        return  end1;
    }
    public static void main(String[] args) {
        test3 the=new test3();
        String end1= the.print("张三",0,2);
        System.out.println(end1);

        //创建数组
       /* String num[] = {"小明", "朱玉", "李四"};
        int be = 0;
        int last = 2;
        for (int i = 0; i < last - be; i++) {
            if (num[i] == "小明 ") {
                System.out.println("查找成功");
            } else {
                System.out.println("没有此人");
            }
        }*/
    }
}
